<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
	</head>
	<script language="javascript">
		function submitAction(actionName){
			document.roleForm.action = actionName ;
			document.roleForm.submit();
		}
		
		function init(){
			document.getElementById("roleName").value = "";
		}
		
		function select(action,id){
			location.href = "${ctx}/" + action + "?roleId=" + id;
		}
		
		function doDelete(action,id){
			if(confirm('是否确认删除？')){
				location.href = "${ctx}/" + action + "?roleId=" + id ;
			}
		}
	</script>
	
	<body>
		<form method="post" action="" name="roleForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2"> 
						角色名称 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="roleName" size="32" value="${role.roleName}">
					</td>
					<td width="20%" class="td2">
						
					</td>
					<td width="30%" class="td2">
						
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="search" value="查询" onClick="submitAction('roleSearch.ac');">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('newRole.ac');">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td1" align="center">
						动作
					</td>
					<td width="50%" class="td1" align="center">
						角色名称
					</td>
					<td width="30%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="role" items="${roleList}">
					<tr>
						<td class="td2" align="center">
							<a href="javascript:select('selectRole.ac','${role.id}');">选择</a>
						</td>
						<td class="td2">
							${role.roleName}
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteRole.ac','${role.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
</html>